package com.ac.scum.log.task.clear;

import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class ClearLogTask {
    private final ClearTaskUtilsMapper clearTaskUtilsMapper;

    @PostConstruct
    @Scheduled(cron = "0 0 0/2 * * ?")
    public void loadCache() {
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_admin");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_bank");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_bomb_defusal");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_bunker");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_bunker_active");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_chat");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_chest");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_chest_ownership");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_discard");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_explosives");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_flag");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_kill");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_lock");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_login");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_rename");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_trade");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_trap");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_vehicle");
        clearTaskUtilsMapper.clearAMonthLogByTable("server_ftp_file_log_violation");
        log.info("Clear A Month Log Success");
    }
}